<template>
    <div class="store-activity">
        <div class="no-data-wrap displayFlex flexCenter"
            v-if="commontMsg && commontMsg.list && commontMsg.list.length == 0">
            <v-no-data v-if="noDataShow"
                :noDataProps="{text:'暂无内容哦～',imgUrl:staticImageUrl('/images/look/no_comment_list1.png')}"></v-no-data>
        </div>
        <full-img-video-swiper v-else-if=" Array.isArray(commontMsg.list) && commontMsg.list.length > 0"
            :rtCommontListProps="rtCommont" :commentListProps="commentListProps" :swiperContentProp="commontMsg"
            :couponsListProp="couponsList" @initGoodsMsg="initBuyShow" @isLike="isLike" @doComment="doComment"
            @showShare="$emit('showShare')" @getSubCommentList="getSubCommentList"
            @getUserMainComment="getUserMainComment" @suspensionCb="suspensionCb" @getAllCounponsFn="getAllCounponsFn"
            @animationCb="animationCb" @openRedPage="openRedPage" @getTemplate="getTemplate">
            <div slot="swiperIn" slot-scope="swiperItem">
                <video-float-footer :bottomSuspensionProp="Object.assign({},swiperItem.swiperItem,{type:'buyShow'})">
                </video-float-footer>
            </div>
        </full-img-video-swiper>
    </div>
</template>

<script>
import FullImgVideoSwiper from "../../components/commonActModel/panoramaVideoSwiper/FullImgVideoSwiper";
// import common from '../../components/commonMethods/common'
// common.iosAutoplay()

export default {
    name: "StoreSwiper",
    data () {
        return {
            storeId: this.$route.query.storeId,
            commentListProps: { userHendleType: 'module5' },//侧边栏评论分享等
            couponsList: [],
            rtCommont: [],
            noDataShow: false,
            commontMsg: {
                list: []
            }
        }
    },
    mounted () {
        this.initBuyShow();
    },
    methods: {
        initBuyShow (obj) {
            /*好评/买家秀*/
            this.noDataShow = false;
            let that = this;
            this.shareType = 4;
            let shareId = 4; //----对应分享类型需要传的ID： 1： 媒体ID 2： 活动id 3:商品id 4:买家秀ID 5: 大师ID
            let url = `${that.NW_API_API_LOCALE_VERSION}/store/${that.storeId}/buyer/show/list?userId=${this.userId}&pageSize=${5}&pageNum=${1}`;
            that.xurl.getLoading(url).then((data) => {
                if (data.success) {
                    let temp = {};
                    let tempList = [];
                    for (let value of data.list) {
                        temp = {
                            dataInfo: value.dataInfo,
                            hadLiked: value.hadLiked,
                            mediaContents: value.mediaContents,
                            mediaComment: value.mediaComment,
                            userName: value.userName,
                            mediaType: value.mediaType,
                            id: value.id,
                            isNeedContentShare: false,
                            storeId: that.storeId,
                            isNeedLocation: true,
                            isNeedLike: true,
                            isNeedComment: false,
                            isNeedShare: true,
                            isNeedServer: true,
                        };
                        tempList.push(temp);
                    }
                    this.rtCommont = tempList;
                    this.commontMsg = Object.assign({}, this.commontMsg, data);
                    setTimeout(() => {
                        this.noDataShow = true;
                    }, 50)

                } else if (data.errMsg) {
                    that.$root.$emit('toast', { msg: data.errMsg })
                } else {
                    that.$root.$emit('toast', { msg: '获取数据出错' })
                }
            })
        },
        getPageMsg (obj) {
            this.$emit('getPageMsg', obj);
        },
        isLike (obj) {
            this.$emit('isLike', obj);
        },
        doComment (obj) {
            this.$emit('doComment', obj);
        },
        showShare (obj) {
            this.$emit('showShare', obj);
        },
        getSubCommentList (obj) {
            this.$emit('getSubCommentList', obj);
        },
        suspensionCb (index) {
            this.$emit('suspensionCb', index);
        },
        getUserMainComment (obj) {
            this.$emit('getUserMainComment', obj);
        },
        openRedPage (obj, callback) {
            this.$emit('openRedPage', obj, callback);
        },
        animationCb (index) {
            this.$emit('animationCb', index);
        },
        getTemplate (index) {
            this.$emit('getTemplate', index);
        },
        getAllCounponsFn (obj) {
            this.$emit('getAllCounponsFn', obj);
        },
    },
    components: {
        'full-img-video-swiper': FullImgVideoSwiper,
        "v-no-data": () => import("../../components/commonActModel/noData/NoData"),
        'video-float-footer': () => import("../../components/commonActModel/panoramaVideoSwiper/VideoFloatFooter"),
    }
}
</script>

<style scoped lang="scss">
.store-activity /deep/ {
    .no-wcomment {
        z-index: 1;
    }
    .look-index-mood {
        position: relative !important;
        padding: 0 !important;
    }
}
.no-data-wrap {
    height: 100vh;
}
</style>